package com.zzyl.nursing.mapper;

import java.util.List;

import com.zzyl.nursing.domain.Elder;
import com.zzyl.nursing.domain.FamilyMemberElder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zzyl.nursing.dto.ElderFamilyDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 家属和老人关联中间表Mapper接口
 * 
 * @author BOOOOOGER
 * @date 2025-10-23
 */
@Mapper
public interface FamilyMemberElderMapper extends BaseMapper<FamilyMemberElder>
{
    /**
     * 查询家属和老人关联中间表
     * 
     * @param id 家属和老人关联中间表主键
     * @return 家属和老人关联中间表
     */
    public FamilyMemberElder selectFamilyMemberElderById(Long id);

    /**
     * 查询家属和老人关联中间表列表
     * 
     * @param familyMemberElder 家属和老人关联中间表
     * @return 家属和老人关联中间表集合
     */
    public List<FamilyMemberElder> selectFamilyMemberElderList(FamilyMemberElder familyMemberElder);

    /**
     * 新增家属和老人关联中间表
     * 
     * @param familyMemberElder 家属和老人关联中间表
     * @return 结果
     */
    public int insertFamilyMemberElder(FamilyMemberElder familyMemberElder);

    /**
     * 修改家属和老人关联中间表
     * 
     * @param familyMemberElder 家属和老人关联中间表
     * @return 结果
     */
    public int updateFamilyMemberElder(FamilyMemberElder familyMemberElder);

    /**
     * 删除家属和老人关联中间表
     * 
     * @param id 家属和老人关联中间表主键
     * @return 结果
     */
    public int deleteFamilyMemberElderById(Long id);

    /**
     * 批量删除家属和老人关联中间表
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFamilyMemberElderByIds(Long[] ids);

    @Select("select elder_id,remark from family_member_elder where member_id = #{userId}")
    List<FamilyMemberElder> selectMyFamily(Long userId);

    @Select("select * from family_member_elder where member_id = #{userId}")
    List<FamilyMemberElder> selectFamilyList(Long userId);
}
